/**
 * <p>Copyright (c) 2017 深圳市鹏途交通科技有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	         </p>
 * <p>创建者   :	lei 
 * 
 * <p>描   述  :   HelloController.java for com.pengtu.gsj.controller.system    </p>
 * 
 * <p>最后修改 : $: 2017年4月18日-下午3:12:20 v 1.0.0	 lei   $ </p>
 * 
 */

package com.pengtu.gsj.controller.checker;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pengtu.gsj.controller.base.CheckTableBaseController;
import com.pengtu.gsj.entity.check.CheckProject;
import com.pengtu.gsj.service.check.CheckModuleService;
import com.pengtu.gsj.service.check.CheckProjectService;
import com.pengtu.gsj.service.system.SysmenuManagerService;

/**
 * 
 * 
 * SelfController
 * 
 * 2017年6月30日 下午4:27:06
 * @author lpk
 * @version 1.0.0
 *
 */
@Controller
@RequestMapping("/check/")
public class SelfController extends CheckTableBaseController {
	
	@Autowired
	private SysmenuManagerService sysmenuManagerService;
	
	@Autowired
	private CheckProjectService checkProjectService;
	
	@Autowired
	private CheckModuleService checkModuleService;
	
	/**
	 * goMaintenance:跳转养护管理自检模块
	 * 适用:
	 * @return String
	 * @exception 
	 * @since  1.0.0
	 */
	@RequestMapping("maintenance")
	public String goMaintenance(){
		return "check/maintenanceManage";
	}
	

	/**
	 * getMenus: 适用:获取菜单
	 * 
	 * @return 分级别菜单列表
	 * @exception
	 * @since 1.0.0
	 */
	@Deprecated
	@RequestMapping(value = "list", produces = "application/json; charset=utf-8")
	@ResponseBody
	public List<Map<String, Object>> getMenus(@ModelAttribute CheckProject checkProject, Model model) {
		String menuIds = checkProject.getMenuIds();
		// 通过menuIds获取对应集合
		List<Map<String, Object>> tableList = sysmenuManagerService.getTableList(menuIds,checkProject.getId());
		return tableList;
	}
	
	
	/**
	 * getMenus: 适用:获取菜单
	 * 
	 * @return 分级别菜单列表
	 * @exception
	 * @since 1.0.0
	 */
	@RequestMapping(value = "result", produces = "application/json; charset=utf-8")
	@ResponseBody
	public List<Map<String, Object>> getZtList(@ModelAttribute CheckProject checkProject) {
		
		List<Map<String, Object>> ZtList = new ArrayList<Map<String,Object>>();
		ZtList = checkModuleService.getCheckResultByProjectId(checkProject.getId());
		return ZtList;
	}
}
